package com.luke.star.bean.enums;

import java.util.LinkedHashMap;
import java.util.Map;

import com.luke.star.bean.enums.StTaskStateEnum;

public enum ErrorCodeEnum{
	s0000("s0000","处理成功"),
	s0001("s0001","请求参数异常"),
	s0002("s0002","修改数据库中不存在"),
	;
	public String code;
	public String desc;
	
	private ErrorCodeEnum(String code, String desc) {
		this.code = code;
		this.desc = desc;
	}
	public static Map<String, String> getDataMap() {
		Map<String,String> keyValueMap = new LinkedHashMap<String, String>();
		for(ErrorCodeEnum single : ErrorCodeEnum.values()){
			keyValueMap.put(single.code, single.desc);
		}
		return keyValueMap;
	}
	public static String getDesc(String code) {
		for (StTaskStateEnum single : StTaskStateEnum.values()) {
			if(single.code.equals(code)) {
				return single.desc;
			}
		}
		return code;
	}
}
